package com.example.demo.request;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
//@JacksonXmlRootElement、@JacksonXmlProperty注解是用来维护对象属性在xml中的对应关系。

/**
 * <xml>
 *   <ToUserName><![CDATA[toUser]]></ToUserName>
 *   <FromUserName><![CDATA[fromUser]]></FromUserName>
 *   <CreateTime>12345678</CreateTime>
 *   <MsgType><![CDATA[text]]></MsgType>
 *   <Content><![CDATA[你好]]></Content>
 * </xml>
 */
@JacksonXmlRootElement(localName = "xml")
public class WxRequest {

    @JacksonXmlProperty(localName = "MsgType")
    private String msgType; //消息类型 判断是事件还是非事件

    @JacksonXmlProperty(localName = "ToUserName")
    private String toUserName; //公众号原始ID
    @JacksonXmlProperty(localName = "FromUserName")
    private String fromUserName; //用户openID
    @JacksonXmlProperty(localName = "CreateTime")
    private Long createTime; //时间戳  单位 秒
    @JacksonXmlProperty(localName = "Content")
    private String content; //文本消息内容
    @JacksonXmlProperty(localName = "MediaId")
    private String mediaId; //视频消息媒体id，可以调用获取临时素材接口拉取数据。
    @JacksonXmlProperty(localName = "Format")
    private String format;
    @JacksonXmlProperty(localName = "MsgId")
    private String msgId; //消息id，64位整型
    @JacksonXmlProperty(localName = "ThumbMediaId")
    private String thumbMediaId; //视频消息缩略图的媒体id，可以调用多媒体文件下载接口拉取数据。

    @JacksonXmlProperty(localName = "Location_X")
    private String locationX;
    @JacksonXmlProperty(localName = "Location_Y")
    private String locationY;
    @JacksonXmlProperty(localName = "Scale")
    private String scale;
    @JacksonXmlProperty(localName = "Label")
    private String label;

    @JacksonXmlProperty(localName = "Event")
    private String event;
    @JacksonXmlProperty(localName = "EventKey")
    private String eventKey;

}